import { IsNotEmpty, Validate } from 'class-validator'
import { isExist } from '../../validator/diyValidator/isExist.validator'
import { Proposition, PropositionSchema } from '../../model/proposition.schema'
export class CreatePropositionDto {
  @IsNotEmpty({ message: '参数不能为空' })
  @Validate(isExist, [Proposition, PropositionSchema], { message: '该帖子已存在' })
  title: string
  description: string | null
  @IsNotEmpty({ message: '参数不能为空' })
  user: string
  @IsNotEmpty({ message: '参数不能为空' })
  bar: string

  imageList: Array<{ url: string; filename: string }> | []
}

//评论类型
export class CommentType {
  @IsNotEmpty({ message: '参数不能为空' })
  content: string
  @IsNotEmpty({ message: '参数不能为空' })
  proposition: string
}

//获取评论接口参数
export class GetCommentType {
  page: number | null
  pagesize: number | null
  @IsNotEmpty({ message: '参数不能为空' })
  proposition: string
}

//给评论或者帖子点赞
export class LikeType {
  user?: string
  proposition?: string
  comment?: string
}
